#include <stdio.h>

void MaxIndex(int arr[], int length, int *max, int *index) {
              *max = arr[0];
              *index = 0;

              for (int i = 1; i < length; i++) {
                            if (arr[i] > *max) {
                                          *max = arr[i];
                                          *index = i;
                           }
                 }
}

int main() {
              int arr[] = {4, 2, 9, 6, 5, 1, 8, 3, 7};
              int length = sizeof(arr) / sizeof(arr[0]);

              int max;
              int index;


             MaxIndex(arr, length, &max, &index);


              printf("最大值: %d\n", max);
              printf("最大值索引: %d\n", index);

              return 0;
}